<template>
    <div>
        <el-table :data="studentList" stripe style="width: 100%">
            <el-table-column prop="open_id" label="openID" width="260" />
            <el-table-column prop="nickname" label="姓名" width="100" />
            <el-table-column label="性别" width="60">
                <template slot-scope="scope">{{ scope.row.gender ? '男' : '女' }}</template>
            </el-table-column>
            <el-table-column prop="sdept_name" label="系部" />
            <el-table-column prop="class_name" label="班级" />
            <el-table-column prop="stunum" label="学号" width="160"  />
            <el-table-column prop="account" label="联系方式" width="160"  />
        </el-table>
        <div class="page">
            <el-pagination background layout="prev, pager, next" :total="studentTotal" :page-size="pagesize" @current-change="cheangePage"/>
        </div>
    </div>
</template>

<script>
    import { mapState,mapActions } from 'vuex';
    export default {
        name: 'WebStudentList',
        data() {
            return {
                page: 0,
                pagesize: 14
            };
        },
        computed: {
            ...mapState('Student',['studentList','studentTotal']),
        },
        methods: {
            ...mapActions('Student',['getStudentList']),
            cheangePage(page){
                let { pagesize } = this;
                this.page = --page;
                this.getStudentList({ page,pagesize });
            }
        },
        mounted(){
            let { page,pagesize } = this;
            this.getStudentList({ page,pagesize });
        }
    };
</script>

<style lang="less" scoped>
    @import "asle/index.less";
    .page {
        .pos_f();
        .pos_rb(20px,20px);
    }
</style>